<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui">
   <ui:composition template="index2.xhtml">  
        <ui:define name="content"> 
            <h:body>
                <p:growl id="cadastro" showDetail="true"/>
                <h:form id="formEditarCadastro">
                    <p:panel header="Cadastro de Post" id="panelDadoscadastro"    >
                        <h:panelGrid columns="1" >

                            <h:outputText value="Codigo"/>
                            <p:inputText value="#{postHandler.p.id_post}" size="40" maxlength="200" required="true" requiredMessage="Campo codigo obrigatório"/>

                            <h:outputText value="Titulo"/>
                            
                            <h:inputText value="#{postHandler.p.titulo}" size="40" maxlength="200" required="true" requiredMessage="Campo titulo obrigatório"/>
                     
                            <h:outputText value="Data"/>
                            <p:calendar value="#{postHandler.p.data}" required="true" requiredMessage="Campo data de nascimento obrigatório."
                                        converterMessage="Data do post invalida."  maxdate="#{clienteHandler.data}" >
                            </p:calendar>
                            <h:outputText value="Descricao"/>
                            <p:editor value="#{postHandler.p.corpo}" width="600" required="true" requiredMessage="Campo escolaridade obrigatório"/>

                            <h:outputText value="#{postHandler.p.id_usuario.nome}"/>
                            
                            <p:column>
                                <p:commandButton action="#{postHandler.salvar}"  value="Salvar" update="usuario panelDadosUsuario"  image="ui-icon ui-icon-disk"/>
                            </p:column>

                            
                            <p:spacer width="0" height="20" />
                        </h:panelGrid>
                    </p:panel>
                </h:form>

                
                <p:confirmDialog message="Deseja realmente excluir registro?" hideEffect="explode" 
                                 header="Excluir" severity="alert" widgetVar="confirmacao" modal="true">
                    <h:form>
                        <p:commandButton value="Sim" oncomplete="confirmacao.hide();" 
                                         ajax="false" action="#{clienteHandler.remover()}" immediate="true"/>
                        <p:commandButton value="Não" onclick="confirmacao.hide()" type="button" immediate="true"/>
                    </h:form>
                </p:confirmDialog>
                
                <p:confirmDialog  message="Deseja Cancelar?" hideEffect="drop" modal="true" 
                                  header="Cancelar cliente" severity="info" widgetVar="cancelar">
                    <h:form>
                        <p:commandButton action="#{clienteHandler.cancelar()}" onclick="cancelar.hide()" value="Sim" update="formEditarCurriculo:panelDadosCurriculo"/>
                        <p:commandButton value="Não" onclick="cancelar.hide()"  type="button"/>
                      
                    </h:form>
                </p:confirmDialog>
                  
                
            </h:body>
        </ui:define>
       
       
    </ui:composition>
</html>
